; Tramp test fixes
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 15 May 2025 13:15:22 +0000 (15:15 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 15 May 2025 13:15:22 +0000 (15:15 +0200)
* test/lisp/net/tramp-tests.el
(tramp-test26-interactive-file-name-completion): Simplify.
(tramp--test-putty-p): Fix docstring.
(tramp--test-scp-p): New defun.
(tramp-test42-utf8): Use it.

test/lisp/net/tramp-tests.el

index 84f864e2d628406de6e5f13fa19567ef87870192..4fe3fca0df875fa167338e91d7161d7aecb8fb5d 100644 (file)
@@ -5096,9 +5096,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
                (dolist
                    (test-and-result
                     ;; These are triples of strings (TEST-STRING
-                    ;; RESULT-CHECK COMPLETION-CHECK).  RESULT-CHECK
-                    ;; could be not unique, in this case it is a list
-                    ;; (RESULT1 RESULT2 ...).
+                    ;; RESULT-CHECK COMPLETION-CHECK).
                     (append
                      ;; Complete method name.
                      (unless (string-empty-p tramp-method-regexp)
@@ -5124,11 +5122,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
                             ipv6-prefix
                             (substring-no-properties
                              host 0 (min 2 (length host))))
-                          (,(concat
-                             tramp-prefix-format hop method-string host-string)
-                           ,(concat
-                             tramp-prefix-format hop method-string
-                             default-user-string host-string))
+                          ,(concat
+                            tramp-prefix-format hop method-string
+                            default-user-string host-string)
                           ,host-string)))
                      ;; Complete user and host name.
                      (unless (or (tramp-string-empty-or-nil-p user)
@@ -5169,14 +5165,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
                         ;; (tramp--test-message
                         ;;  "syntax: %s style: %s test: %s result: %s"
                         ;;  syntax style test result)
-                       (if (stringp (cadr test-and-result))
-                           (should
-                            (string-prefix-p (cadr test-and-result) result))
-                         (should
-                          (let (res)
-                            (dolist (elem (cadr test-and-result) res)
-                              (setq
-                               res (or res (string-prefix-p elem result))))))))
+                       (should (string-prefix-p (cadr test-and-result) result)))
 
                     (with-current-buffer "*Completions*"
                      ;; We must remove leading `default-directory'.
@@ -7379,7 +7368,7 @@ This does not support external Emacs calls."
   (tramp-method-out-of-band-p tramp-test-vec 1))
 
 (defun tramp--test-putty-p ()
-  "Check, whether the method method usaes PuTTY.
+  "Check, whether the method uses PuTTY.
 This does not support connection share for more than two connections."
   (member
    (file-remote-p ert-remote-temporary-file-directory 'method)
@@ -7396,6 +7385,15 @@ This does not support special file names."
   (string-equal
    "rsync" (file-remote-p ert-remote-temporary-file-directory 'method)))
 
+(defun tramp--test-scp-p ()
+  "Check, whether an scp method is used.
+This does not support quoted special characters in recent sshd
+implementations."
+  ;; Detected with OpenSSH_9.9p1.
+  (member
+   (file-remote-p ert-remote-temporary-file-directory 'method)
+   '("pscp" "scp" "scpx")))
+
 (defun tramp--test-sh-p ()
   "Check, whether the remote host runs a based method from tramp-sh.el."
   (tramp-sh-file-name-handler-p tramp-test-vec))
@@ -7768,6 +7766,7 @@ This requires restrictions of file name syntax."
   (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; SLOW ~ 620s
   (skip-unless (not (tramp--test-container-p)))
   (skip-unless (not (tramp--test-rsync-p)))
+  (skip-unless (not (tramp--test-scp-p)))
   (skip-unless (not (tramp--test-windows-nt-and-out-of-band-p)))
   (skip-unless (not (tramp--test-ksh-p)))
   (skip-unless (not (tramp--test-gdrive-p)))